

package top.continew.admin.controller.question;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.question.model.QuestionInfoQuery;
import top.continew.admin.question.model.UserQuestionInfoQuery;
import top.continew.admin.question.manger.service.StatisticalService;
import top.continew.starter.web.model.R;

@RestController
@RequestMapping("statistical")
public class StatisticalController {
    @Autowired
    private StatisticalService statisticalService;

    @GetMapping("initQuestion")
    public R setQuestion() throws Exception {
        statisticalService.setQuestion();
        return R.ok();
    }

    @GetMapping("getQuestionInfoList")
    public R getQuestionInfoList(QuestionInfoQuery questionInfoQuery) throws Exception {
        return R.ok(statisticalService.getQuestionInfoList(questionInfoQuery));
    }

    @GetMapping("getQuestionInfoUseInfo")
    public R getQuestionInfoUseInfo(String phone, String questionInfoId) throws Exception {
        return R.ok(statisticalService.getQuestionInfoUseInfo(phone, questionInfoId));
    }

    @GetMapping("getUserQuestionInfoList")
    public R getUserQuestionInfoList(UserQuestionInfoQuery userQuestionInfoQuery) throws Exception {
        return R.ok(statisticalService.getUserQuestionInfoList(userQuestionInfoQuery));
    }

    @GetMapping("getQuestionSetByUser")
    public R getQuestionSetByUser(String name, String userId) throws Exception {
        return R.ok(statisticalService.getQuestionSetByUser(name, userId));
    }

}
